﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace diploma.test.core
{
    public class SingleQuestion : Question
    {
        private string answer;
        List<string> options;

        public SingleQuestion(string _question, string _answer, IEnumerable<string> _options)
            : base(_question)
        {
            this.answer = _answer;
            this.options = new List<string>(_options);
        }

        public int RightOption
        {
            get
            {
                int q = this.options.BinarySearch(answer.Trim());
                if (this.options[0] == answer) q = 0;
                return q;
            }
        }

        public string[] Options
        {
            get
            {
                return options.ToArray();
            }
        }

        public override QuestionTypes Type
        {
            get
            {
                return QuestionTypes.Single;
            }
        }
    }
}
